package com.xja.service.impl;

import com.xja.dao.LwdDao;
import com.xja.dao.impl.LwdDaoImpl;
import com.xja.entity.Indent;
import com.xja.entity.Register;
import com.xja.entity.User;
import com.xja.entity.WorkPeople;
import com.xja.service.LwdService;

import java.util.List;

public class LwdServiceImpl implements LwdService {
    LwdDao lwdDao=new LwdDaoImpl();

    @Override
    public List<User> findAllUser() {
        return lwdDao.findAllUser();
    }
//查询用户是否存在
    @Override
    public User findUserById(Integer id) {
        return lwdDao.findUserById(id);
    }

    @Override
    public Boolean updateUser(User user) {
        int i=lwdDao.updateUser(user);
        if (i>0){
            return true;
        }else {
            return false;
        }


    }

    @Override
    public Boolean deleUser(Integer id) {
        int i=lwdDao.deleUser(id);
        if (i>0){
            return true;
        }
        return false;
    }

    @Override
    public Register createRegisterByUserId(Integer id) {
        return lwdDao.createRegisterByUserId(id);
    }
//事务处理
    @Override
    public boolean updateRegisterAndIndent(Register register) {

        return lwdDao.updateRegisterAndIndent(register);
    }

    @Override
    public Indent findIndentById(Integer id) {
        return lwdDao.findIndentById(id);
    }

    @Override
    public List<WorkPeople> findAllWork() {
        return lwdDao.findAllWork();
    }

    @Override
    public WorkPeople findWorkById(Integer id) {
        return lwdDao.findWorkById(id);
    }

    @Override
    public Boolean updateWork(WorkPeople workPeople) {
        if (lwdDao.updateWork(workPeople)>0)
            return true;
        return false;
    }

    @Override
    public Boolean addWork(WorkPeople workPeople) {
        if (lwdDao.addWork(workPeople)>0)
            return true;
        return false;
    }

    @Override
    public Boolean deleWork(Integer id) {
        if (lwdDao.deleWork(id)>0)
            return true;
        return false;
    }
}
